package com.example.plan.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.plan.common.result.Result;
import com.example.plan.entity.ArNavigation;
import com.example.plan.model.dto.arNavigation.ArNavigationDTO;
import com.example.plan.model.dto.arNavigation.ArNavigationPageDTO;
import com.example.plan.model.vo.ArNavigationVO;
import com.example.plan.service.ArNavigationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@Data
@Slf4j
@Api(tags = "AR导航标记模块")
@RestController
@RequestMapping("arNavigations")
public class ArNavigationController {
    private final ArNavigationService arNavigationService;

    @ApiOperation(value = "新增AR导航标记")
    @PostMapping("/saveArNavigation")
    public Result<Void> saveArNavigation(@RequestBody @Validated ArNavigationDTO dto) {
        return arNavigationService.saveArNavigation(dto);
    }
    @ApiOperation(value = "删除AR导航标记")
    @GetMapping("/deleteArNavigation/{navId}")
    public Result<Void> deleteArNavigation(@PathVariable @NotNull Long navId) {
        return arNavigationService.deleteArNavigation(navId);
    }
    @ApiOperation(value = "查询AR导航标记详情")
    @GetMapping("/getArNavigation/{navId}")
    public Result<ArNavigationVO> getArNavigation(@PathVariable @NotNull Long navId) {
        return arNavigationService.getArNavigation(navId);
    }
    @ApiOperation(value = "分页带条件查询AR导航标记")
    @PostMapping("/pageArNavigation")
    public Result<IPage<ArNavigationVO>> pageArNavigation(@RequestBody @Validated ArNavigationPageDTO dto) {
        return arNavigationService.pageArNavigation(dto);
    }

    @ApiOperation(value = "修改AR导航标记")
    @PostMapping("/updateArNavigation")
    public Result<Void> updateArNavigation(@RequestBody @Validated ArNavigationDTO dto) {
        return arNavigationService.updateArNavigation(dto);
    }
}
